<?php
//echo count($_FILES);var_dump($_FILES);
foreach ( $_FILES as $key => $value ) :

	//if ((($value ["type"] == "image/gif") || ($value ["type"] == "image/jpeg") || ($value ["type"] == "image/pjpeg")) && ($value ["size"] < 20000)) {
	  if ($value ["size"] < 2000000) {
		if ($value ["error"] > 0) {
			echo "Return Code: " . $value ["error"] . "<br />";
		} else {
			echo "Upload: " . $value ["name"] . "<br />";
			echo "Type: " . $value ["type"] . "<br />";
			echo "Size: " . ($value ["size"] / 1024) . " Kb<br />";
			echo "Temp file: " . $value ["tmp_name"] . "<br />";
			
			if (file_exists ( "upload/" . $value ["name"] )) {
				echo $value ["name"] . " 已经存在了. ";
			} else {
				move_uploaded_file ( $value ["tmp_name"], "upload/" . $value ["name"] );
				echo "Stored in: " . "upload/" . $value ["name"];
			}
		}
	} else {
		echo "文件太大了<br>";
	}

endforeach;
?>